package lan_2021;

/**
 * @Author wly
 * @Create 2023-03-26 15:47
 * @Description:https://www.lanqiao.cn/problems/1443/learning/?page=1&first_category_id=1&sort=students_count&name=%E5%8D%A1%E7%89%87
 */
public class Card01 {
    public static void main(String[] args) {
        int[] nums = new int[10];
        for (int i = 0; i < nums.length; i++) {
            nums[i] = 2021;
        }
        int n = 1;
        boolean flag = false;
        while (true){
            int t = n;
            while (t != 0){
                int temp = t % 10;
                if (nums[temp] == 0){
                    flag = true;
                    break;
                }else {
                    nums[temp]--;
                    t /= 10;
                }
            }

            if (flag) break;
            n++;
        }
        System.out.print(n - 1);
    }
}
